﻿using System;
using System.Data;
using System.Text;
using System.Data.SqlClient;
using DBUtility;//Please add references
namespace TierApplication
{
    /// <summary>
    /// 类T_Order。
    /// </summary>
    [Serializable]
    public partial class T_Order
    {
        public T_Order()
        { }
        #region Model
        private string _orderid;
        private string _porderid;
        private DateTime? _orderdate;
        private string _orderuserid;
        private string _orderno;
        private string _contractno;
        private string _ordercode;
        private string _supplierid;
        private string _custid;
        private string _ordertype;
        private string _ordersort;
        private string _orderstatus;
        private string _depotid;
        private string _todepotid;
        private string _audituserid;
        private DateTime? _auditdate;
        private string _auditremark;
        private string _submituserid;
        private DateTime? _submitdate;
        private string _remark;
        private string _confirmuserid;
        private DateTime? _confirmdate;
        private int? _sign = 0;
        private string _paytype;
        private DateTime? _payrstdate;
        private string _paystatus;
        private string _payerfullname;
        private string _payerbank;
        private string _payebankaccount;
        private decimal? _payfee;
        private string _payreason;
        private string _payremark;
        private string _payuserid;
        private string _payaudituserid;
        private DateTime? _payauditdate;
        private string _payauditopinion;
        private string _payauditremark;
        private string _payinguserid;
        private DateTime? _payingdate;
        private string _transfer = "0";
        private string _invoiceisneed;
        private string _invoicetitle;
        private string _invoicecontent;
        private string _invoiceremark;
        private string _saleremark;
        private decimal? _saleamt;
        private DateTime? _requireddate;
        private string _shippingtype;
        private string _shipingrequired;
        private decimal? _expressfee = 0M;
        private decimal? _cashfee = 0M;
        private decimal? _otherfee = 0M;
        private DateTime? _createdate = DateTime.Now;
        private string _createuser;
        private string _remark1;
        private string _remark2;
        private decimal? _totaplnqty;
        private decimal? _totaactqty;
        private decimal? _totabckqty;
        private decimal? _totalprice;
        private decimal? _totalstockedqty;
        private decimal? _totalstockingqty;
        private decimal? _totalinvoicefee;
        private decimal? _totalreturnfee;
        /// <summary>
        /// 
        /// </summary>
        public string OrderID
        {
            set { _orderid = value; }
            get { return _orderid; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string POrderID
        {
            set { _porderid = value; }
            get { return _porderid; }
        }
        /// <summary>
        /// 
        /// </summary>
        public DateTime? OrderDate
        {
            set { _orderdate = value; }
            get { return _orderdate; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string OrderUserID
        {
            set { _orderuserid = value; }
            get { return _orderuserid; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string OrderNo
        {
            set { _orderno = value; }
            get { return _orderno; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string ContractNo
        {
            set { _contractno = value; }
            get { return _contractno; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string OrderCode
        {
            set { _ordercode = value; }
            get { return _ordercode; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string SupplierID
        {
            set { _supplierid = value; }
            get { return _supplierid; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string CustID
        {
            set { _custid = value; }
            get { return _custid; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string OrderType
        {
            set { _ordertype = value; }
            get { return _ordertype; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string OrderSort
        {
            set { _ordersort = value; }
            get { return _ordersort; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string OrderStatus
        {
            set { _orderstatus = value; }
            get { return _orderstatus; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string DepotID
        {
            set { _depotid = value; }
            get { return _depotid; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string ToDepotID
        {
            set { _todepotid = value; }
            get { return _todepotid; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string AuditUserID
        {
            set { _audituserid = value; }
            get { return _audituserid; }
        }
        /// <summary>
        /// 
        /// </summary>
        public DateTime? AuditDate
        {
            set { _auditdate = value; }
            get { return _auditdate; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string AuditRemark
        {
            set { _auditremark = value; }
            get { return _auditremark; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string SubmitUserID
        {
            set { _submituserid = value; }
            get { return _submituserid; }
        }
        /// <summary>
        /// 
        /// </summary>
        public DateTime? SubmitDate
        {
            set { _submitdate = value; }
            get { return _submitdate; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string Remark
        {
            set { _remark = value; }
            get { return _remark; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string ConfirmUserID
        {
            set { _confirmuserid = value; }
            get { return _confirmuserid; }
        }
        /// <summary>
        /// 
        /// </summary>
        public DateTime? ConfirmDate
        {
            set { _confirmdate = value; }
            get { return _confirmdate; }
        }
        /// <summary>
        /// 
        /// </summary>
        public int? Sign
        {
            set { _sign = value; }
            get { return _sign; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string PayType
        {
            set { _paytype = value; }
            get { return _paytype; }
        }
        /// <summary>
        /// 
        /// </summary>
        public DateTime? PayRstDate
        {
            set { _payrstdate = value; }
            get { return _payrstdate; }
        }
        /// <summary>
        /// 付款状况
        /// </summary>
        public string PayStatus
        {
            set { _paystatus = value; }
            get { return _paystatus; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string PayerFullName
        {
            set { _payerfullname = value; }
            get { return _payerfullname; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string PayerBank
        {
            set { _payerbank = value; }
            get { return _payerbank; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string PayeBankAccount
        {
            set { _payebankaccount = value; }
            get { return _payebankaccount; }
        }
        /// <summary>
        /// 
        /// </summary>
        public decimal? PayFee
        {
            set { _payfee = value; }
            get { return _payfee; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string PayReason
        {
            set { _payreason = value; }
            get { return _payreason; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string PayRemark
        {
            set { _payremark = value; }
            get { return _payremark; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string PayUserID
        {
            set { _payuserid = value; }
            get { return _payuserid; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string PayAuditUserID
        {
            set { _payaudituserid = value; }
            get { return _payaudituserid; }
        }
        /// <summary>
        /// 
        /// </summary>
        public DateTime? PayAuditDate
        {
            set { _payauditdate = value; }
            get { return _payauditdate; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string PayAuditOpinion
        {
            set { _payauditopinion = value; }
            get { return _payauditopinion; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string PayAuditRemark
        {
            set { _payauditremark = value; }
            get { return _payauditremark; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string PayingUserID
        {
            set { _payinguserid = value; }
            get { return _payinguserid; }
        }
        /// <summary>
        /// 
        /// </summary>
        public DateTime? PayingDate
        {
            set { _payingdate = value; }
            get { return _payingdate; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string Transfer
        {
            set { _transfer = value; }
            get { return _transfer; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string InvoiceIsNeed
        {
            set { _invoiceisneed = value; }
            get { return _invoiceisneed; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string InvoiceTitle
        {
            set { _invoicetitle = value; }
            get { return _invoicetitle; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string InvoiceContent
        {
            set { _invoicecontent = value; }
            get { return _invoicecontent; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string InvoiceRemark
        {
            set { _invoiceremark = value; }
            get { return _invoiceremark; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string SaleRemark
        {
            set { _saleremark = value; }
            get { return _saleremark; }
        }
        /// <summary>
        /// 
        /// </summary>
        public decimal? SaleAmt
        {
            set { _saleamt = value; }
            get { return _saleamt; }
        }
        /// <summary>
        /// 要求送货日期
        /// </summary>
        public DateTime? RequiredDate
        {
            set { _requireddate = value; }
            get { return _requireddate; }
        }
        /// <summary>
        /// 送货方式
        /// </summary>
        public string ShippingType
        {
            set { _shippingtype = value; }
            get { return _shippingtype; }
        }
        /// <summary>
        /// 运送要求
        /// </summary>
        public string ShipingRequired
        {
            set { _shipingrequired = value; }
            get { return _shipingrequired; }
        }
        /// <summary>
        /// 运费
        /// </summary>
        public decimal? ExpressFee
        {
            set { _expressfee = value; }
            get { return _expressfee; }
        }
        /// <summary>
        /// 现金金额
        /// </summary>
        public decimal? CashFee
        {
            set { _cashfee = value; }
            get { return _cashfee; }
        }
        /// <summary>
        /// 
        /// </summary>
        public decimal? OtherFee
        {
            set { _otherfee = value; }
            get { return _otherfee; }
        }
        /// <summary>
        /// 
        /// </summary>
        public DateTime? CreateDate
        {
            set { _createdate = value; }
            get { return _createdate; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string CreateUser
        {
            set { _createuser = value; }
            get { return _createuser; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string Remark1
        {
            set { _remark1 = value; }
            get { return _remark1; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string Remark2
        {
            set { _remark2 = value; }
            get { return _remark2; }
        }
        /// <summary>
        /// 
        /// </summary>
        public decimal? TotaPlnQty
        {
            set { _totaplnqty = value; }
            get { return _totaplnqty; }
        }
        /// <summary>
        /// 
        /// </summary>
        public decimal? TotaActQty
        {
            set { _totaactqty = value; }
            get { return _totaactqty; }
        }
        /// <summary>
        /// 
        /// </summary>
        public decimal? TotaBckQty
        {
            set { _totabckqty = value; }
            get { return _totabckqty; }
        }
        /// <summary>
        /// 
        /// </summary>
        public decimal? TotalPrice
        {
            set { _totalprice = value; }
            get { return _totalprice; }
        }
        /// <summary>
        /// 
        /// </summary>
        public decimal? TotalStockedQty
        {
            set { _totalstockedqty = value; }
            get { return _totalstockedqty; }
        }
        /// <summary>
        /// 
        /// </summary>
        public decimal? TotalStockingQty
        {
            set { _totalstockingqty = value; }
            get { return _totalstockingqty; }
        }
        /// <summary>
        /// 
        /// </summary>
        public decimal? TotalInvoiceFee
        {
            set { _totalinvoicefee = value; }
            get { return _totalinvoicefee; }
        }
        /// <summary>
        /// 
        /// </summary>
        public decimal? TotalReturnFee
        {
            set { _totalreturnfee = value; }
            get { return _totalreturnfee; }
        }
        #endregion Model


        #region  Method

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public T_Order(string OrderID)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select OrderID,POrderID,OrderDate,OrderUserID,OrderNo,ContractNo,OrderCode,SupplierID,CustID,OrderType,OrderSort,OrderStatus,DepotID,ToDepotID,AuditUserID,AuditDate,AuditRemark,SubmitUserID,SubmitDate,Remark,ConfirmUserID,ConfirmDate,Sign,PayType,PayRstDate,PayStatus,PayerFullName,PayerBank,PayeBankAccount,PayFee,PayReason,PayRemark,PayUserID,PayAuditUserID,PayAuditDate,PayAuditOpinion,PayAuditRemark,PayingUserID,PayingDate,Transfer,InvoiceIsNeed,InvoiceTitle,InvoiceContent,InvoiceRemark,SaleRemark,SaleAmt,RequiredDate,ShippingType,ShipingRequired,ExpressFee,CashFee,OtherFee,CreateDate,CreateUser,Remark1,Remark2,TotaPlnQty,TotaActQty,TotaBckQty,TotalPrice,TotalStockedQty,TotalStockingQty,TotalInvoiceFee,TotalReturnFee ");
            strSql.Append(" FROM [T_Order] ");
            strSql.Append(" where OrderID=@OrderID ");
            SqlParameter[] parameters = {
					new SqlParameter("@OrderID", SqlDbType.VarChar,-1)};
            parameters[0].Value = OrderID;

            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["OrderID"] != null)
                {
                    this.OrderID = ds.Tables[0].Rows[0]["OrderID"].ToString();
                }
                if (ds.Tables[0].Rows[0]["POrderID"] != null)
                {
                    this.POrderID = ds.Tables[0].Rows[0]["POrderID"].ToString();
                }
                if (ds.Tables[0].Rows[0]["OrderDate"] != null && ds.Tables[0].Rows[0]["OrderDate"].ToString() != "")
                {
                    this.OrderDate = DateTime.Parse(ds.Tables[0].Rows[0]["OrderDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["OrderUserID"] != null)
                {
                    this.OrderUserID = ds.Tables[0].Rows[0]["OrderUserID"].ToString();
                }
                if (ds.Tables[0].Rows[0]["OrderNo"] != null)
                {
                    this.OrderNo = ds.Tables[0].Rows[0]["OrderNo"].ToString();
                }
                if (ds.Tables[0].Rows[0]["ContractNo"] != null)
                {
                    this.ContractNo = ds.Tables[0].Rows[0]["ContractNo"].ToString();
                }
                if (ds.Tables[0].Rows[0]["OrderCode"] != null)
                {
                    this.OrderCode = ds.Tables[0].Rows[0]["OrderCode"].ToString();
                }
                if (ds.Tables[0].Rows[0]["SupplierID"] != null)
                {
                    this.SupplierID = ds.Tables[0].Rows[0]["SupplierID"].ToString();
                }
                if (ds.Tables[0].Rows[0]["CustID"] != null)
                {
                    this.CustID = ds.Tables[0].Rows[0]["CustID"].ToString();
                }
                if (ds.Tables[0].Rows[0]["OrderType"] != null)
                {
                    this.OrderType = ds.Tables[0].Rows[0]["OrderType"].ToString();
                }
                if (ds.Tables[0].Rows[0]["OrderSort"] != null)
                {
                    this.OrderSort = ds.Tables[0].Rows[0]["OrderSort"].ToString();
                }
                if (ds.Tables[0].Rows[0]["OrderStatus"] != null)
                {
                    this.OrderStatus = ds.Tables[0].Rows[0]["OrderStatus"].ToString();
                }
                if (ds.Tables[0].Rows[0]["DepotID"] != null)
                {
                    this.DepotID = ds.Tables[0].Rows[0]["DepotID"].ToString();
                }
                if (ds.Tables[0].Rows[0]["ToDepotID"] != null)
                {
                    this.ToDepotID = ds.Tables[0].Rows[0]["ToDepotID"].ToString();
                }
                if (ds.Tables[0].Rows[0]["AuditUserID"] != null)
                {
                    this.AuditUserID = ds.Tables[0].Rows[0]["AuditUserID"].ToString();
                }
                if (ds.Tables[0].Rows[0]["AuditDate"] != null && ds.Tables[0].Rows[0]["AuditDate"].ToString() != "")
                {
                    this.AuditDate = DateTime.Parse(ds.Tables[0].Rows[0]["AuditDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["AuditRemark"] != null)
                {
                    this.AuditRemark = ds.Tables[0].Rows[0]["AuditRemark"].ToString();
                }
                if (ds.Tables[0].Rows[0]["SubmitUserID"] != null)
                {
                    this.SubmitUserID = ds.Tables[0].Rows[0]["SubmitUserID"].ToString();
                }
                if (ds.Tables[0].Rows[0]["SubmitDate"] != null && ds.Tables[0].Rows[0]["SubmitDate"].ToString() != "")
                {
                    this.SubmitDate = DateTime.Parse(ds.Tables[0].Rows[0]["SubmitDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Remark"] != null)
                {
                    this.Remark = ds.Tables[0].Rows[0]["Remark"].ToString();
                }
                if (ds.Tables[0].Rows[0]["ConfirmUserID"] != null)
                {
                    this.ConfirmUserID = ds.Tables[0].Rows[0]["ConfirmUserID"].ToString();
                }
                if (ds.Tables[0].Rows[0]["ConfirmDate"] != null && ds.Tables[0].Rows[0]["ConfirmDate"].ToString() != "")
                {
                    this.ConfirmDate = DateTime.Parse(ds.Tables[0].Rows[0]["ConfirmDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Sign"] != null && ds.Tables[0].Rows[0]["Sign"].ToString() != "")
                {
                    this.Sign = int.Parse(ds.Tables[0].Rows[0]["Sign"].ToString());
                }
                if (ds.Tables[0].Rows[0]["PayType"] != null)
                {
                    this.PayType = ds.Tables[0].Rows[0]["PayType"].ToString();
                }
                if (ds.Tables[0].Rows[0]["PayRstDate"] != null && ds.Tables[0].Rows[0]["PayRstDate"].ToString() != "")
                {
                    this.PayRstDate = DateTime.Parse(ds.Tables[0].Rows[0]["PayRstDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["PayStatus"] != null)
                {
                    this.PayStatus = ds.Tables[0].Rows[0]["PayStatus"].ToString();
                }
                if (ds.Tables[0].Rows[0]["PayerFullName"] != null)
                {
                    this.PayerFullName = ds.Tables[0].Rows[0]["PayerFullName"].ToString();
                }
                if (ds.Tables[0].Rows[0]["PayerBank"] != null)
                {
                    this.PayerBank = ds.Tables[0].Rows[0]["PayerBank"].ToString();
                }
                if (ds.Tables[0].Rows[0]["PayeBankAccount"] != null)
                {
                    this.PayeBankAccount = ds.Tables[0].Rows[0]["PayeBankAccount"].ToString();
                }
                if (ds.Tables[0].Rows[0]["PayFee"] != null && ds.Tables[0].Rows[0]["PayFee"].ToString() != "")
                {
                    this.PayFee = decimal.Parse(ds.Tables[0].Rows[0]["PayFee"].ToString());
                }
                if (ds.Tables[0].Rows[0]["PayReason"] != null)
                {
                    this.PayReason = ds.Tables[0].Rows[0]["PayReason"].ToString();
                }
                if (ds.Tables[0].Rows[0]["PayRemark"] != null)
                {
                    this.PayRemark = ds.Tables[0].Rows[0]["PayRemark"].ToString();
                }
                if (ds.Tables[0].Rows[0]["PayUserID"] != null)
                {
                    this.PayUserID = ds.Tables[0].Rows[0]["PayUserID"].ToString();
                }
                if (ds.Tables[0].Rows[0]["PayAuditUserID"] != null)
                {
                    this.PayAuditUserID = ds.Tables[0].Rows[0]["PayAuditUserID"].ToString();
                }
                if (ds.Tables[0].Rows[0]["PayAuditDate"] != null && ds.Tables[0].Rows[0]["PayAuditDate"].ToString() != "")
                {
                    this.PayAuditDate = DateTime.Parse(ds.Tables[0].Rows[0]["PayAuditDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["PayAuditOpinion"] != null)
                {
                    this.PayAuditOpinion = ds.Tables[0].Rows[0]["PayAuditOpinion"].ToString();
                }
                if (ds.Tables[0].Rows[0]["PayAuditRemark"] != null)
                {
                    this.PayAuditRemark = ds.Tables[0].Rows[0]["PayAuditRemark"].ToString();
                }
                if (ds.Tables[0].Rows[0]["PayingUserID"] != null)
                {
                    this.PayingUserID = ds.Tables[0].Rows[0]["PayingUserID"].ToString();
                }
                if (ds.Tables[0].Rows[0]["PayingDate"] != null && ds.Tables[0].Rows[0]["PayingDate"].ToString() != "")
                {
                    this.PayingDate = DateTime.Parse(ds.Tables[0].Rows[0]["PayingDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Transfer"] != null)
                {
                    this.Transfer = ds.Tables[0].Rows[0]["Transfer"].ToString();
                }
                if (ds.Tables[0].Rows[0]["InvoiceIsNeed"] != null)
                {
                    this.InvoiceIsNeed = ds.Tables[0].Rows[0]["InvoiceIsNeed"].ToString();
                }
                if (ds.Tables[0].Rows[0]["InvoiceTitle"] != null)
                {
                    this.InvoiceTitle = ds.Tables[0].Rows[0]["InvoiceTitle"].ToString();
                }
                if (ds.Tables[0].Rows[0]["InvoiceContent"] != null)
                {
                    this.InvoiceContent = ds.Tables[0].Rows[0]["InvoiceContent"].ToString();
                }
                if (ds.Tables[0].Rows[0]["InvoiceRemark"] != null)
                {
                    this.InvoiceRemark = ds.Tables[0].Rows[0]["InvoiceRemark"].ToString();
                }
                if (ds.Tables[0].Rows[0]["SaleRemark"] != null)
                {
                    this.SaleRemark = ds.Tables[0].Rows[0]["SaleRemark"].ToString();
                }
                if (ds.Tables[0].Rows[0]["SaleAmt"] != null && ds.Tables[0].Rows[0]["SaleAmt"].ToString() != "")
                {
                    this.SaleAmt = decimal.Parse(ds.Tables[0].Rows[0]["SaleAmt"].ToString());
                }
                if (ds.Tables[0].Rows[0]["RequiredDate"] != null && ds.Tables[0].Rows[0]["RequiredDate"].ToString() != "")
                {
                    this.RequiredDate = DateTime.Parse(ds.Tables[0].Rows[0]["RequiredDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["ShippingType"] != null)
                {
                    this.ShippingType = ds.Tables[0].Rows[0]["ShippingType"].ToString();
                }
                if (ds.Tables[0].Rows[0]["ShipingRequired"] != null)
                {
                    this.ShipingRequired = ds.Tables[0].Rows[0]["ShipingRequired"].ToString();
                }
                if (ds.Tables[0].Rows[0]["ExpressFee"] != null && ds.Tables[0].Rows[0]["ExpressFee"].ToString() != "")
                {
                    this.ExpressFee = decimal.Parse(ds.Tables[0].Rows[0]["ExpressFee"].ToString());
                }
                if (ds.Tables[0].Rows[0]["CashFee"] != null && ds.Tables[0].Rows[0]["CashFee"].ToString() != "")
                {
                    this.CashFee = decimal.Parse(ds.Tables[0].Rows[0]["CashFee"].ToString());
                }
                if (ds.Tables[0].Rows[0]["OtherFee"] != null && ds.Tables[0].Rows[0]["OtherFee"].ToString() != "")
                {
                    this.OtherFee = decimal.Parse(ds.Tables[0].Rows[0]["OtherFee"].ToString());
                }
                if (ds.Tables[0].Rows[0]["CreateDate"] != null && ds.Tables[0].Rows[0]["CreateDate"].ToString() != "")
                {
                    this.CreateDate = DateTime.Parse(ds.Tables[0].Rows[0]["CreateDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["CreateUser"] != null)
                {
                    this.CreateUser = ds.Tables[0].Rows[0]["CreateUser"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Remark1"] != null)
                {
                    this.Remark1 = ds.Tables[0].Rows[0]["Remark1"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Remark2"] != null)
                {
                    this.Remark2 = ds.Tables[0].Rows[0]["Remark2"].ToString();
                }
                if (ds.Tables[0].Rows[0]["TotaPlnQty"] != null && ds.Tables[0].Rows[0]["TotaPlnQty"].ToString() != "")
                {
                    this.TotaPlnQty = decimal.Parse(ds.Tables[0].Rows[0]["TotaPlnQty"].ToString());
                }
                if (ds.Tables[0].Rows[0]["TotaActQty"] != null && ds.Tables[0].Rows[0]["TotaActQty"].ToString() != "")
                {
                    this.TotaActQty = decimal.Parse(ds.Tables[0].Rows[0]["TotaActQty"].ToString());
                }
                if (ds.Tables[0].Rows[0]["TotaBckQty"] != null && ds.Tables[0].Rows[0]["TotaBckQty"].ToString() != "")
                {
                    this.TotaBckQty = decimal.Parse(ds.Tables[0].Rows[0]["TotaBckQty"].ToString());
                }
                if (ds.Tables[0].Rows[0]["TotalPrice"] != null && ds.Tables[0].Rows[0]["TotalPrice"].ToString() != "")
                {
                    this.TotalPrice = decimal.Parse(ds.Tables[0].Rows[0]["TotalPrice"].ToString());
                }
                if (ds.Tables[0].Rows[0]["TotalStockedQty"] != null && ds.Tables[0].Rows[0]["TotalStockedQty"].ToString() != "")
                {
                    this.TotalStockedQty = decimal.Parse(ds.Tables[0].Rows[0]["TotalStockedQty"].ToString());
                }
                if (ds.Tables[0].Rows[0]["TotalStockingQty"] != null && ds.Tables[0].Rows[0]["TotalStockingQty"].ToString() != "")
                {
                    this.TotalStockingQty = decimal.Parse(ds.Tables[0].Rows[0]["TotalStockingQty"].ToString());
                }
                if (ds.Tables[0].Rows[0]["TotalInvoiceFee"] != null && ds.Tables[0].Rows[0]["TotalInvoiceFee"].ToString() != "")
                {
                    this.TotalInvoiceFee = decimal.Parse(ds.Tables[0].Rows[0]["TotalInvoiceFee"].ToString());
                }
                if (ds.Tables[0].Rows[0]["TotalReturnFee"] != null && ds.Tables[0].Rows[0]["TotalReturnFee"].ToString() != "")
                {
                    this.TotalReturnFee = decimal.Parse(ds.Tables[0].Rows[0]["TotalReturnFee"].ToString());
                }
            }
        }

        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(string OrderID)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select count(1) from [T_Order]");
            strSql.Append(" where OrderID=@OrderID ");

            SqlParameter[] parameters = {
					new SqlParameter("@OrderID", SqlDbType.VarChar,-1)};
            parameters[0].Value = OrderID;

            return DbHelperSQL.Exists(strSql.ToString(), parameters);
        }


        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add()
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into [T_Order] (");
            strSql.Append("OrderID,POrderID,OrderDate,OrderUserID,OrderNo,ContractNo,OrderCode,SupplierID,CustID,OrderType,OrderSort,OrderStatus,DepotID,ToDepotID,AuditUserID,AuditDate,AuditRemark,SubmitUserID,SubmitDate,Remark,ConfirmUserID,ConfirmDate,Sign,PayType,PayRstDate,PayStatus,PayerFullName,PayerBank,PayeBankAccount,PayFee,PayReason,PayRemark,PayUserID,PayAuditUserID,PayAuditDate,PayAuditOpinion,PayAuditRemark,PayingUserID,PayingDate,Transfer,InvoiceIsNeed,InvoiceTitle,InvoiceContent,InvoiceRemark,SaleRemark,SaleAmt,RequiredDate,ShippingType,ShipingRequired,ExpressFee,CashFee,OtherFee,CreateDate,CreateUser,Remark1,Remark2,TotaPlnQty,TotaActQty,TotaBckQty,TotalPrice,TotalStockedQty,TotalStockingQty,TotalInvoiceFee,TotalReturnFee)");
            strSql.Append(" values (");
            strSql.Append("@OrderID,@POrderID,@OrderDate,@OrderUserID,@OrderNo,@ContractNo,@OrderCode,@SupplierID,@CustID,@OrderType,@OrderSort,@OrderStatus,@DepotID,@ToDepotID,@AuditUserID,@AuditDate,@AuditRemark,@SubmitUserID,@SubmitDate,@Remark,@ConfirmUserID,@ConfirmDate,@Sign,@PayType,@PayRstDate,@PayStatus,@PayerFullName,@PayerBank,@PayeBankAccount,@PayFee,@PayReason,@PayRemark,@PayUserID,@PayAuditUserID,@PayAuditDate,@PayAuditOpinion,@PayAuditRemark,@PayingUserID,@PayingDate,@Transfer,@InvoiceIsNeed,@InvoiceTitle,@InvoiceContent,@InvoiceRemark,@SaleRemark,@SaleAmt,@RequiredDate,@ShippingType,@ShipingRequired,@ExpressFee,@CashFee,@OtherFee,@CreateDate,@CreateUser,@Remark1,@Remark2,@TotaPlnQty,@TotaActQty,@TotaBckQty,@TotalPrice,@TotalStockedQty,@TotalStockingQty,@TotalInvoiceFee,@TotalReturnFee)");
            SqlParameter[] parameters = {
					new SqlParameter("@OrderID", SqlDbType.VarChar,10),
					new SqlParameter("@POrderID", SqlDbType.VarChar,10),
					new SqlParameter("@OrderDate", SqlDbType.DateTime),
					new SqlParameter("@OrderUserID", SqlDbType.VarChar,10),
					new SqlParameter("@OrderNo", SqlDbType.VarChar,50),
					new SqlParameter("@ContractNo", SqlDbType.VarChar,60),
					new SqlParameter("@OrderCode", SqlDbType.VarChar,50),
					new SqlParameter("@SupplierID", SqlDbType.VarChar,10),
					new SqlParameter("@CustID", SqlDbType.VarChar,10),
					new SqlParameter("@OrderType", SqlDbType.VarChar,10),
					new SqlParameter("@OrderSort", SqlDbType.VarChar,10),
					new SqlParameter("@OrderStatus", SqlDbType.VarChar,10),
					new SqlParameter("@DepotID", SqlDbType.VarChar,10),
					new SqlParameter("@ToDepotID", SqlDbType.VarChar,10),
					new SqlParameter("@AuditUserID", SqlDbType.VarChar,10),
					new SqlParameter("@AuditDate", SqlDbType.DateTime),
					new SqlParameter("@AuditRemark", SqlDbType.VarChar,250),
					new SqlParameter("@SubmitUserID", SqlDbType.VarChar,10),
					new SqlParameter("@SubmitDate", SqlDbType.DateTime),
					new SqlParameter("@Remark", SqlDbType.VarChar,200),
					new SqlParameter("@ConfirmUserID", SqlDbType.VarChar,50),
					new SqlParameter("@ConfirmDate", SqlDbType.DateTime),
					new SqlParameter("@Sign", SqlDbType.Int,4),
					new SqlParameter("@PayType", SqlDbType.VarChar,80),
					new SqlParameter("@PayRstDate", SqlDbType.DateTime),
					new SqlParameter("@PayStatus", SqlDbType.VarChar,6),
					new SqlParameter("@PayerFullName", SqlDbType.VarChar,100),
					new SqlParameter("@PayerBank", SqlDbType.VarChar,100),
					new SqlParameter("@PayeBankAccount", SqlDbType.VarChar,20),
					new SqlParameter("@PayFee", SqlDbType.Decimal,9),
					new SqlParameter("@PayReason", SqlDbType.VarChar,250),
					new SqlParameter("@PayRemark", SqlDbType.VarChar,250),
					new SqlParameter("@PayUserID", SqlDbType.VarChar,10),
					new SqlParameter("@PayAuditUserID", SqlDbType.VarChar,50),
					new SqlParameter("@PayAuditDate", SqlDbType.DateTime),
					new SqlParameter("@PayAuditOpinion", SqlDbType.VarChar,250),
					new SqlParameter("@PayAuditRemark", SqlDbType.VarChar,250),
					new SqlParameter("@PayingUserID", SqlDbType.VarChar,50),
					new SqlParameter("@PayingDate", SqlDbType.DateTime),
					new SqlParameter("@Transfer", SqlDbType.VarChar,1),
					new SqlParameter("@InvoiceIsNeed", SqlDbType.VarChar,1),
					new SqlParameter("@InvoiceTitle", SqlDbType.VarChar,100),
					new SqlParameter("@InvoiceContent", SqlDbType.VarChar,250),
					new SqlParameter("@InvoiceRemark", SqlDbType.VarChar,250),
					new SqlParameter("@SaleRemark", SqlDbType.VarChar,50),
					new SqlParameter("@SaleAmt", SqlDbType.Decimal,9),
					new SqlParameter("@RequiredDate", SqlDbType.DateTime),
					new SqlParameter("@ShippingType", SqlDbType.VarChar,10),
					new SqlParameter("@ShipingRequired", SqlDbType.VarChar,200),
					new SqlParameter("@ExpressFee", SqlDbType.Decimal,9),
					new SqlParameter("@CashFee", SqlDbType.Decimal,9),
					new SqlParameter("@OtherFee", SqlDbType.Decimal,9),
					new SqlParameter("@CreateDate", SqlDbType.DateTime),
					new SqlParameter("@CreateUser", SqlDbType.VarChar,20),
					new SqlParameter("@Remark1", SqlDbType.VarChar,50),
					new SqlParameter("@Remark2", SqlDbType.VarChar,50),
					new SqlParameter("@TotaPlnQty", SqlDbType.Decimal,9),
					new SqlParameter("@TotaActQty", SqlDbType.Decimal,9),
					new SqlParameter("@TotaBckQty", SqlDbType.Decimal,9),
					new SqlParameter("@TotalPrice", SqlDbType.Decimal,9),
					new SqlParameter("@TotalStockedQty", SqlDbType.Decimal,9),
					new SqlParameter("@TotalStockingQty", SqlDbType.Decimal,9),
					new SqlParameter("@TotalInvoiceFee", SqlDbType.Decimal,9),
					new SqlParameter("@TotalReturnFee", SqlDbType.Decimal,9)};
            parameters[0].Value = OrderID;
            parameters[1].Value = POrderID;
            parameters[2].Value = OrderDate;
            parameters[3].Value = OrderUserID;
            parameters[4].Value = OrderNo;
            parameters[5].Value = ContractNo;
            parameters[6].Value = OrderCode;
            parameters[7].Value = SupplierID;
            parameters[8].Value = CustID;
            parameters[9].Value = OrderType;
            parameters[10].Value = OrderSort;
            parameters[11].Value = OrderStatus;
            parameters[12].Value = DepotID;
            parameters[13].Value = ToDepotID;
            parameters[14].Value = AuditUserID;
            parameters[15].Value = AuditDate;
            parameters[16].Value = AuditRemark;
            parameters[17].Value = SubmitUserID;
            parameters[18].Value = SubmitDate;
            parameters[19].Value = Remark;
            parameters[20].Value = ConfirmUserID;
            parameters[21].Value = ConfirmDate;
            parameters[22].Value = Sign;
            parameters[23].Value = PayType;
            parameters[24].Value = PayRstDate;
            parameters[25].Value = PayStatus;
            parameters[26].Value = PayerFullName;
            parameters[27].Value = PayerBank;
            parameters[28].Value = PayeBankAccount;
            parameters[29].Value = PayFee;
            parameters[30].Value = PayReason;
            parameters[31].Value = PayRemark;
            parameters[32].Value = PayUserID;
            parameters[33].Value = PayAuditUserID;
            parameters[34].Value = PayAuditDate;
            parameters[35].Value = PayAuditOpinion;
            parameters[36].Value = PayAuditRemark;
            parameters[37].Value = PayingUserID;
            parameters[38].Value = PayingDate;
            parameters[39].Value = Transfer;
            parameters[40].Value = InvoiceIsNeed;
            parameters[41].Value = InvoiceTitle;
            parameters[42].Value = InvoiceContent;
            parameters[43].Value = InvoiceRemark;
            parameters[44].Value = SaleRemark;
            parameters[45].Value = SaleAmt;
            parameters[46].Value = RequiredDate;
            parameters[47].Value = ShippingType;
            parameters[48].Value = ShipingRequired;
            parameters[49].Value = ExpressFee;
            parameters[50].Value = CashFee;
            parameters[51].Value = OtherFee;
            parameters[52].Value = CreateDate;
            parameters[53].Value = CreateUser;
            parameters[54].Value = Remark1;
            parameters[55].Value = Remark2;
            parameters[56].Value = TotaPlnQty;
            parameters[57].Value = TotaActQty;
            parameters[58].Value = TotaBckQty;
            parameters[59].Value = TotalPrice;
            parameters[60].Value = TotalStockedQty;
            parameters[61].Value = TotalStockingQty;
            parameters[62].Value = TotalInvoiceFee;
            parameters[63].Value = TotalReturnFee;

            DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update()
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update [T_Order] set ");
            strSql.Append("POrderID=@POrderID,");
            strSql.Append("OrderDate=@OrderDate,");
            strSql.Append("OrderUserID=@OrderUserID,");
            strSql.Append("OrderNo=@OrderNo,");
            strSql.Append("ContractNo=@ContractNo,");
            strSql.Append("OrderCode=@OrderCode,");
            strSql.Append("SupplierID=@SupplierID,");
            strSql.Append("CustID=@CustID,");
            strSql.Append("OrderType=@OrderType,");
            strSql.Append("OrderSort=@OrderSort,");
            strSql.Append("OrderStatus=@OrderStatus,");
            strSql.Append("DepotID=@DepotID,");
            strSql.Append("ToDepotID=@ToDepotID,");
            strSql.Append("AuditUserID=@AuditUserID,");
            strSql.Append("AuditDate=@AuditDate,");
            strSql.Append("AuditRemark=@AuditRemark,");
            strSql.Append("SubmitUserID=@SubmitUserID,");
            strSql.Append("SubmitDate=@SubmitDate,");
            strSql.Append("Remark=@Remark,");
            strSql.Append("ConfirmUserID=@ConfirmUserID,");
            strSql.Append("ConfirmDate=@ConfirmDate,");
            strSql.Append("Sign=@Sign,");
            strSql.Append("PayType=@PayType,");
            strSql.Append("PayRstDate=@PayRstDate,");
            strSql.Append("PayStatus=@PayStatus,");
            strSql.Append("PayerFullName=@PayerFullName,");
            strSql.Append("PayerBank=@PayerBank,");
            strSql.Append("PayeBankAccount=@PayeBankAccount,");
            strSql.Append("PayFee=@PayFee,");
            strSql.Append("PayReason=@PayReason,");
            strSql.Append("PayRemark=@PayRemark,");
            strSql.Append("PayUserID=@PayUserID,");
            strSql.Append("PayAuditUserID=@PayAuditUserID,");
            strSql.Append("PayAuditDate=@PayAuditDate,");
            strSql.Append("PayAuditOpinion=@PayAuditOpinion,");
            strSql.Append("PayAuditRemark=@PayAuditRemark,");
            strSql.Append("PayingUserID=@PayingUserID,");
            strSql.Append("PayingDate=@PayingDate,");
            strSql.Append("Transfer=@Transfer,");
            strSql.Append("InvoiceIsNeed=@InvoiceIsNeed,");
            strSql.Append("InvoiceTitle=@InvoiceTitle,");
            strSql.Append("InvoiceContent=@InvoiceContent,");
            strSql.Append("InvoiceRemark=@InvoiceRemark,");
            strSql.Append("SaleRemark=@SaleRemark,");
            strSql.Append("SaleAmt=@SaleAmt,");
            strSql.Append("RequiredDate=@RequiredDate,");
            strSql.Append("ShippingType=@ShippingType,");
            strSql.Append("ShipingRequired=@ShipingRequired,");
            strSql.Append("ExpressFee=@ExpressFee,");
            strSql.Append("CashFee=@CashFee,");
            strSql.Append("OtherFee=@OtherFee,");
            strSql.Append("CreateDate=@CreateDate,");
            strSql.Append("CreateUser=@CreateUser,");
            strSql.Append("Remark1=@Remark1,");
            strSql.Append("Remark2=@Remark2,");
            strSql.Append("TotaPlnQty=@TotaPlnQty,");
            strSql.Append("TotaActQty=@TotaActQty,");
            strSql.Append("TotaBckQty=@TotaBckQty,");
            strSql.Append("TotalPrice=@TotalPrice,");
            strSql.Append("TotalStockedQty=@TotalStockedQty,");
            strSql.Append("TotalStockingQty=@TotalStockingQty,");
            strSql.Append("TotalInvoiceFee=@TotalInvoiceFee,");
            strSql.Append("TotalReturnFee=@TotalReturnFee");
            strSql.Append(" where OrderID=@OrderID ");
            SqlParameter[] parameters = {
					new SqlParameter("@POrderID", SqlDbType.VarChar,10),
					new SqlParameter("@OrderDate", SqlDbType.DateTime),
					new SqlParameter("@OrderUserID", SqlDbType.VarChar,10),
					new SqlParameter("@OrderNo", SqlDbType.VarChar,50),
					new SqlParameter("@ContractNo", SqlDbType.VarChar,60),
					new SqlParameter("@OrderCode", SqlDbType.VarChar,50),
					new SqlParameter("@SupplierID", SqlDbType.VarChar,10),
					new SqlParameter("@CustID", SqlDbType.VarChar,10),
					new SqlParameter("@OrderType", SqlDbType.VarChar,10),
					new SqlParameter("@OrderSort", SqlDbType.VarChar,10),
					new SqlParameter("@OrderStatus", SqlDbType.VarChar,10),
					new SqlParameter("@DepotID", SqlDbType.VarChar,10),
					new SqlParameter("@ToDepotID", SqlDbType.VarChar,10),
					new SqlParameter("@AuditUserID", SqlDbType.VarChar,10),
					new SqlParameter("@AuditDate", SqlDbType.DateTime),
					new SqlParameter("@AuditRemark", SqlDbType.VarChar,250),
					new SqlParameter("@SubmitUserID", SqlDbType.VarChar,10),
					new SqlParameter("@SubmitDate", SqlDbType.DateTime),
					new SqlParameter("@Remark", SqlDbType.VarChar,200),
					new SqlParameter("@ConfirmUserID", SqlDbType.VarChar,50),
					new SqlParameter("@ConfirmDate", SqlDbType.DateTime),
					new SqlParameter("@Sign", SqlDbType.Int,4),
					new SqlParameter("@PayType", SqlDbType.VarChar,80),
					new SqlParameter("@PayRstDate", SqlDbType.DateTime),
					new SqlParameter("@PayStatus", SqlDbType.VarChar,6),
					new SqlParameter("@PayerFullName", SqlDbType.VarChar,100),
					new SqlParameter("@PayerBank", SqlDbType.VarChar,100),
					new SqlParameter("@PayeBankAccount", SqlDbType.VarChar,20),
					new SqlParameter("@PayFee", SqlDbType.Decimal,9),
					new SqlParameter("@PayReason", SqlDbType.VarChar,250),
					new SqlParameter("@PayRemark", SqlDbType.VarChar,250),
					new SqlParameter("@PayUserID", SqlDbType.VarChar,10),
					new SqlParameter("@PayAuditUserID", SqlDbType.VarChar,50),
					new SqlParameter("@PayAuditDate", SqlDbType.DateTime),
					new SqlParameter("@PayAuditOpinion", SqlDbType.VarChar,250),
					new SqlParameter("@PayAuditRemark", SqlDbType.VarChar,250),
					new SqlParameter("@PayingUserID", SqlDbType.VarChar,50),
					new SqlParameter("@PayingDate", SqlDbType.DateTime),
					new SqlParameter("@Transfer", SqlDbType.VarChar,1),
					new SqlParameter("@InvoiceIsNeed", SqlDbType.VarChar,1),
					new SqlParameter("@InvoiceTitle", SqlDbType.VarChar,100),
					new SqlParameter("@InvoiceContent", SqlDbType.VarChar,250),
					new SqlParameter("@InvoiceRemark", SqlDbType.VarChar,250),
					new SqlParameter("@SaleRemark", SqlDbType.VarChar,50),
					new SqlParameter("@SaleAmt", SqlDbType.Decimal,9),
					new SqlParameter("@RequiredDate", SqlDbType.DateTime),
					new SqlParameter("@ShippingType", SqlDbType.VarChar,10),
					new SqlParameter("@ShipingRequired", SqlDbType.VarChar,200),
					new SqlParameter("@ExpressFee", SqlDbType.Decimal,9),
					new SqlParameter("@CashFee", SqlDbType.Decimal,9),
					new SqlParameter("@OtherFee", SqlDbType.Decimal,9),
					new SqlParameter("@CreateDate", SqlDbType.DateTime),
					new SqlParameter("@CreateUser", SqlDbType.VarChar,20),
					new SqlParameter("@Remark1", SqlDbType.VarChar,50),
					new SqlParameter("@Remark2", SqlDbType.VarChar,50),
					new SqlParameter("@TotaPlnQty", SqlDbType.Decimal,9),
					new SqlParameter("@TotaActQty", SqlDbType.Decimal,9),
					new SqlParameter("@TotaBckQty", SqlDbType.Decimal,9),
					new SqlParameter("@TotalPrice", SqlDbType.Decimal,9),
					new SqlParameter("@TotalStockedQty", SqlDbType.Decimal,9),
					new SqlParameter("@TotalStockingQty", SqlDbType.Decimal,9),
					new SqlParameter("@TotalInvoiceFee", SqlDbType.Decimal,9),
					new SqlParameter("@TotalReturnFee", SqlDbType.Decimal,9),
					new SqlParameter("@OrderID", SqlDbType.VarChar,10)};
            parameters[0].Value = POrderID;
            parameters[1].Value = OrderDate;
            parameters[2].Value = OrderUserID;
            parameters[3].Value = OrderNo;
            parameters[4].Value = ContractNo;
            parameters[5].Value = OrderCode;
            parameters[6].Value = SupplierID;
            parameters[7].Value = CustID;
            parameters[8].Value = OrderType;
            parameters[9].Value = OrderSort;
            parameters[10].Value = OrderStatus;
            parameters[11].Value = DepotID;
            parameters[12].Value = ToDepotID;
            parameters[13].Value = AuditUserID;
            parameters[14].Value = AuditDate;
            parameters[15].Value = AuditRemark;
            parameters[16].Value = SubmitUserID;
            parameters[17].Value = SubmitDate;
            parameters[18].Value = Remark;
            parameters[19].Value = ConfirmUserID;
            parameters[20].Value = ConfirmDate;
            parameters[21].Value = Sign;
            parameters[22].Value = PayType;
            parameters[23].Value = PayRstDate;
            parameters[24].Value = PayStatus;
            parameters[25].Value = PayerFullName;
            parameters[26].Value = PayerBank;
            parameters[27].Value = PayeBankAccount;
            parameters[28].Value = PayFee;
            parameters[29].Value = PayReason;
            parameters[30].Value = PayRemark;
            parameters[31].Value = PayUserID;
            parameters[32].Value = PayAuditUserID;
            parameters[33].Value = PayAuditDate;
            parameters[34].Value = PayAuditOpinion;
            parameters[35].Value = PayAuditRemark;
            parameters[36].Value = PayingUserID;
            parameters[37].Value = PayingDate;
            parameters[38].Value = Transfer;
            parameters[39].Value = InvoiceIsNeed;
            parameters[40].Value = InvoiceTitle;
            parameters[41].Value = InvoiceContent;
            parameters[42].Value = InvoiceRemark;
            parameters[43].Value = SaleRemark;
            parameters[44].Value = SaleAmt;
            parameters[45].Value = RequiredDate;
            parameters[46].Value = ShippingType;
            parameters[47].Value = ShipingRequired;
            parameters[48].Value = ExpressFee;
            parameters[49].Value = CashFee;
            parameters[50].Value = OtherFee;
            parameters[51].Value = CreateDate;
            parameters[52].Value = CreateUser;
            parameters[53].Value = Remark1;
            parameters[54].Value = Remark2;
            parameters[55].Value = TotaPlnQty;
            parameters[56].Value = TotaActQty;
            parameters[57].Value = TotaBckQty;
            parameters[58].Value = TotalPrice;
            parameters[59].Value = TotalStockedQty;
            parameters[60].Value = TotalStockingQty;
            parameters[61].Value = TotalInvoiceFee;
            parameters[62].Value = TotalReturnFee;
            parameters[63].Value = OrderID;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(string OrderID)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete from [T_Order] ");
            strSql.Append(" where OrderID=@OrderID ");
            SqlParameter[] parameters = {
					new SqlParameter("@OrderID", SqlDbType.VarChar,-1)};
            parameters[0].Value = OrderID;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }


        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public void GetModel(string OrderID)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select OrderID,POrderID,OrderDate,OrderUserID,OrderNo,ContractNo,OrderCode,SupplierID,CustID,OrderType,OrderSort,OrderStatus,DepotID,ToDepotID,AuditUserID,AuditDate,AuditRemark,SubmitUserID,SubmitDate,Remark,ConfirmUserID,ConfirmDate,Sign,PayType,PayRstDate,PayStatus,PayerFullName,PayerBank,PayeBankAccount,PayFee,PayReason,PayRemark,PayUserID,PayAuditUserID,PayAuditDate,PayAuditOpinion,PayAuditRemark,PayingUserID,PayingDate,Transfer,InvoiceIsNeed,InvoiceTitle,InvoiceContent,InvoiceRemark,SaleRemark,SaleAmt,RequiredDate,ShippingType,ShipingRequired,ExpressFee,CashFee,OtherFee,CreateDate,CreateUser,Remark1,Remark2,TotaPlnQty,TotaActQty,TotaBckQty,TotalPrice,TotalStockedQty,TotalStockingQty,TotalInvoiceFee,TotalReturnFee ");
            strSql.Append(" FROM [T_Order] ");
            strSql.Append(" where OrderID=@OrderID ");
            SqlParameter[] parameters = {
					new SqlParameter("@OrderID", SqlDbType.VarChar,-1)};
            parameters[0].Value = OrderID;

            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["OrderID"] != null)
                {
                    this.OrderID = ds.Tables[0].Rows[0]["OrderID"].ToString();
                }
                if (ds.Tables[0].Rows[0]["POrderID"] != null)
                {
                    this.POrderID = ds.Tables[0].Rows[0]["POrderID"].ToString();
                }
                if (ds.Tables[0].Rows[0]["OrderDate"] != null && ds.Tables[0].Rows[0]["OrderDate"].ToString() != "")
                {
                    this.OrderDate = DateTime.Parse(ds.Tables[0].Rows[0]["OrderDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["OrderUserID"] != null)
                {
                    this.OrderUserID = ds.Tables[0].Rows[0]["OrderUserID"].ToString();
                }
                if (ds.Tables[0].Rows[0]["OrderNo"] != null)
                {
                    this.OrderNo = ds.Tables[0].Rows[0]["OrderNo"].ToString();
                }
                if (ds.Tables[0].Rows[0]["ContractNo"] != null)
                {
                    this.ContractNo = ds.Tables[0].Rows[0]["ContractNo"].ToString();
                }
                if (ds.Tables[0].Rows[0]["OrderCode"] != null)
                {
                    this.OrderCode = ds.Tables[0].Rows[0]["OrderCode"].ToString();
                }
                if (ds.Tables[0].Rows[0]["SupplierID"] != null)
                {
                    this.SupplierID = ds.Tables[0].Rows[0]["SupplierID"].ToString();
                }
                if (ds.Tables[0].Rows[0]["CustID"] != null)
                {
                    this.CustID = ds.Tables[0].Rows[0]["CustID"].ToString();
                }
                if (ds.Tables[0].Rows[0]["OrderType"] != null)
                {
                    this.OrderType = ds.Tables[0].Rows[0]["OrderType"].ToString();
                }
                if (ds.Tables[0].Rows[0]["OrderSort"] != null)
                {
                    this.OrderSort = ds.Tables[0].Rows[0]["OrderSort"].ToString();
                }
                if (ds.Tables[0].Rows[0]["OrderStatus"] != null)
                {
                    this.OrderStatus = ds.Tables[0].Rows[0]["OrderStatus"].ToString();
                }
                if (ds.Tables[0].Rows[0]["DepotID"] != null)
                {
                    this.DepotID = ds.Tables[0].Rows[0]["DepotID"].ToString();
                }
                if (ds.Tables[0].Rows[0]["ToDepotID"] != null)
                {
                    this.ToDepotID = ds.Tables[0].Rows[0]["ToDepotID"].ToString();
                }
                if (ds.Tables[0].Rows[0]["AuditUserID"] != null)
                {
                    this.AuditUserID = ds.Tables[0].Rows[0]["AuditUserID"].ToString();
                }
                if (ds.Tables[0].Rows[0]["AuditDate"] != null && ds.Tables[0].Rows[0]["AuditDate"].ToString() != "")
                {
                    this.AuditDate = DateTime.Parse(ds.Tables[0].Rows[0]["AuditDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["AuditRemark"] != null)
                {
                    this.AuditRemark = ds.Tables[0].Rows[0]["AuditRemark"].ToString();
                }
                if (ds.Tables[0].Rows[0]["SubmitUserID"] != null)
                {
                    this.SubmitUserID = ds.Tables[0].Rows[0]["SubmitUserID"].ToString();
                }
                if (ds.Tables[0].Rows[0]["SubmitDate"] != null && ds.Tables[0].Rows[0]["SubmitDate"].ToString() != "")
                {
                    this.SubmitDate = DateTime.Parse(ds.Tables[0].Rows[0]["SubmitDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Remark"] != null)
                {
                    this.Remark = ds.Tables[0].Rows[0]["Remark"].ToString();
                }
                if (ds.Tables[0].Rows[0]["ConfirmUserID"] != null)
                {
                    this.ConfirmUserID = ds.Tables[0].Rows[0]["ConfirmUserID"].ToString();
                }
                if (ds.Tables[0].Rows[0]["ConfirmDate"] != null && ds.Tables[0].Rows[0]["ConfirmDate"].ToString() != "")
                {
                    this.ConfirmDate = DateTime.Parse(ds.Tables[0].Rows[0]["ConfirmDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Sign"] != null && ds.Tables[0].Rows[0]["Sign"].ToString() != "")
                {
                    this.Sign = int.Parse(ds.Tables[0].Rows[0]["Sign"].ToString());
                }
                if (ds.Tables[0].Rows[0]["PayType"] != null)
                {
                    this.PayType = ds.Tables[0].Rows[0]["PayType"].ToString();
                }
                if (ds.Tables[0].Rows[0]["PayRstDate"] != null && ds.Tables[0].Rows[0]["PayRstDate"].ToString() != "")
                {
                    this.PayRstDate = DateTime.Parse(ds.Tables[0].Rows[0]["PayRstDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["PayStatus"] != null)
                {
                    this.PayStatus = ds.Tables[0].Rows[0]["PayStatus"].ToString();
                }
                if (ds.Tables[0].Rows[0]["PayerFullName"] != null)
                {
                    this.PayerFullName = ds.Tables[0].Rows[0]["PayerFullName"].ToString();
                }
                if (ds.Tables[0].Rows[0]["PayerBank"] != null)
                {
                    this.PayerBank = ds.Tables[0].Rows[0]["PayerBank"].ToString();
                }
                if (ds.Tables[0].Rows[0]["PayeBankAccount"] != null)
                {
                    this.PayeBankAccount = ds.Tables[0].Rows[0]["PayeBankAccount"].ToString();
                }
                if (ds.Tables[0].Rows[0]["PayFee"] != null && ds.Tables[0].Rows[0]["PayFee"].ToString() != "")
                {
                    this.PayFee = decimal.Parse(ds.Tables[0].Rows[0]["PayFee"].ToString());
                }
                if (ds.Tables[0].Rows[0]["PayReason"] != null)
                {
                    this.PayReason = ds.Tables[0].Rows[0]["PayReason"].ToString();
                }
                if (ds.Tables[0].Rows[0]["PayRemark"] != null)
                {
                    this.PayRemark = ds.Tables[0].Rows[0]["PayRemark"].ToString();
                }
                if (ds.Tables[0].Rows[0]["PayUserID"] != null)
                {
                    this.PayUserID = ds.Tables[0].Rows[0]["PayUserID"].ToString();
                }
                if (ds.Tables[0].Rows[0]["PayAuditUserID"] != null)
                {
                    this.PayAuditUserID = ds.Tables[0].Rows[0]["PayAuditUserID"].ToString();
                }
                if (ds.Tables[0].Rows[0]["PayAuditDate"] != null && ds.Tables[0].Rows[0]["PayAuditDate"].ToString() != "")
                {
                    this.PayAuditDate = DateTime.Parse(ds.Tables[0].Rows[0]["PayAuditDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["PayAuditOpinion"] != null)
                {
                    this.PayAuditOpinion = ds.Tables[0].Rows[0]["PayAuditOpinion"].ToString();
                }
                if (ds.Tables[0].Rows[0]["PayAuditRemark"] != null)
                {
                    this.PayAuditRemark = ds.Tables[0].Rows[0]["PayAuditRemark"].ToString();
                }
                if (ds.Tables[0].Rows[0]["PayingUserID"] != null)
                {
                    this.PayingUserID = ds.Tables[0].Rows[0]["PayingUserID"].ToString();
                }
                if (ds.Tables[0].Rows[0]["PayingDate"] != null && ds.Tables[0].Rows[0]["PayingDate"].ToString() != "")
                {
                    this.PayingDate = DateTime.Parse(ds.Tables[0].Rows[0]["PayingDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Transfer"] != null)
                {
                    this.Transfer = ds.Tables[0].Rows[0]["Transfer"].ToString();
                }
                if (ds.Tables[0].Rows[0]["InvoiceIsNeed"] != null)
                {
                    this.InvoiceIsNeed = ds.Tables[0].Rows[0]["InvoiceIsNeed"].ToString();
                }
                if (ds.Tables[0].Rows[0]["InvoiceTitle"] != null)
                {
                    this.InvoiceTitle = ds.Tables[0].Rows[0]["InvoiceTitle"].ToString();
                }
                if (ds.Tables[0].Rows[0]["InvoiceContent"] != null)
                {
                    this.InvoiceContent = ds.Tables[0].Rows[0]["InvoiceContent"].ToString();
                }
                if (ds.Tables[0].Rows[0]["InvoiceRemark"] != null)
                {
                    this.InvoiceRemark = ds.Tables[0].Rows[0]["InvoiceRemark"].ToString();
                }
                if (ds.Tables[0].Rows[0]["SaleRemark"] != null)
                {
                    this.SaleRemark = ds.Tables[0].Rows[0]["SaleRemark"].ToString();
                }
                if (ds.Tables[0].Rows[0]["SaleAmt"] != null && ds.Tables[0].Rows[0]["SaleAmt"].ToString() != "")
                {
                    this.SaleAmt = decimal.Parse(ds.Tables[0].Rows[0]["SaleAmt"].ToString());
                }
                if (ds.Tables[0].Rows[0]["RequiredDate"] != null && ds.Tables[0].Rows[0]["RequiredDate"].ToString() != "")
                {
                    this.RequiredDate = DateTime.Parse(ds.Tables[0].Rows[0]["RequiredDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["ShippingType"] != null)
                {
                    this.ShippingType = ds.Tables[0].Rows[0]["ShippingType"].ToString();
                }
                if (ds.Tables[0].Rows[0]["ShipingRequired"] != null)
                {
                    this.ShipingRequired = ds.Tables[0].Rows[0]["ShipingRequired"].ToString();
                }
                if (ds.Tables[0].Rows[0]["ExpressFee"] != null && ds.Tables[0].Rows[0]["ExpressFee"].ToString() != "")
                {
                    this.ExpressFee = decimal.Parse(ds.Tables[0].Rows[0]["ExpressFee"].ToString());
                }
                if (ds.Tables[0].Rows[0]["CashFee"] != null && ds.Tables[0].Rows[0]["CashFee"].ToString() != "")
                {
                    this.CashFee = decimal.Parse(ds.Tables[0].Rows[0]["CashFee"].ToString());
                }
                if (ds.Tables[0].Rows[0]["OtherFee"] != null && ds.Tables[0].Rows[0]["OtherFee"].ToString() != "")
                {
                    this.OtherFee = decimal.Parse(ds.Tables[0].Rows[0]["OtherFee"].ToString());
                }
                if (ds.Tables[0].Rows[0]["CreateDate"] != null && ds.Tables[0].Rows[0]["CreateDate"].ToString() != "")
                {
                    this.CreateDate = DateTime.Parse(ds.Tables[0].Rows[0]["CreateDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["CreateUser"] != null)
                {
                    this.CreateUser = ds.Tables[0].Rows[0]["CreateUser"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Remark1"] != null)
                {
                    this.Remark1 = ds.Tables[0].Rows[0]["Remark1"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Remark2"] != null)
                {
                    this.Remark2 = ds.Tables[0].Rows[0]["Remark2"].ToString();
                }
                if (ds.Tables[0].Rows[0]["TotaPlnQty"] != null && ds.Tables[0].Rows[0]["TotaPlnQty"].ToString() != "")
                {
                    this.TotaPlnQty = decimal.Parse(ds.Tables[0].Rows[0]["TotaPlnQty"].ToString());
                }
                if (ds.Tables[0].Rows[0]["TotaActQty"] != null && ds.Tables[0].Rows[0]["TotaActQty"].ToString() != "")
                {
                    this.TotaActQty = decimal.Parse(ds.Tables[0].Rows[0]["TotaActQty"].ToString());
                }
                if (ds.Tables[0].Rows[0]["TotaBckQty"] != null && ds.Tables[0].Rows[0]["TotaBckQty"].ToString() != "")
                {
                    this.TotaBckQty = decimal.Parse(ds.Tables[0].Rows[0]["TotaBckQty"].ToString());
                }
                if (ds.Tables[0].Rows[0]["TotalPrice"] != null && ds.Tables[0].Rows[0]["TotalPrice"].ToString() != "")
                {
                    this.TotalPrice = decimal.Parse(ds.Tables[0].Rows[0]["TotalPrice"].ToString());
                }
                if (ds.Tables[0].Rows[0]["TotalStockedQty"] != null && ds.Tables[0].Rows[0]["TotalStockedQty"].ToString() != "")
                {
                    this.TotalStockedQty = decimal.Parse(ds.Tables[0].Rows[0]["TotalStockedQty"].ToString());
                }
                if (ds.Tables[0].Rows[0]["TotalStockingQty"] != null && ds.Tables[0].Rows[0]["TotalStockingQty"].ToString() != "")
                {
                    this.TotalStockingQty = decimal.Parse(ds.Tables[0].Rows[0]["TotalStockingQty"].ToString());
                }
                if (ds.Tables[0].Rows[0]["TotalInvoiceFee"] != null && ds.Tables[0].Rows[0]["TotalInvoiceFee"].ToString() != "")
                {
                    this.TotalInvoiceFee = decimal.Parse(ds.Tables[0].Rows[0]["TotalInvoiceFee"].ToString());
                }
                if (ds.Tables[0].Rows[0]["TotalReturnFee"] != null && ds.Tables[0].Rows[0]["TotalReturnFee"].ToString() != "")
                {
                    this.TotalReturnFee = decimal.Parse(ds.Tables[0].Rows[0]["TotalReturnFee"].ToString());
                }
            }
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select * ");
            strSql.Append(" FROM [T_Order] ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            return DbHelperSQL.Query(strSql.ToString());
        }

        #endregion  Method
    }
}

